<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
	//out.write(basePath);
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户管理</title>

<link href="<%=basePath %>bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="<%=basePath %>bootstrap/css/bootstrap.css" rel="stylesheet" />
<script src="<%=basePath %>bootstrap/js/jquery-1.6.2.js"></script>
<script src="<%=basePath %>bootstrap/js/jquery.min.js"></script>
<link href="<%=basePath %>bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<script type="text/javascript">
$(function(){
	console.info("年龄aga");

	var currentAge = $("#txtAge")[0].value;
	console.info("年龄"+currentAge);
	//没有获取到年龄，或者后台没有传入年龄（新增操作）
	if(currentAge == undefined || currentAge == ""){
		//设置默认值为18
		currentAge = 18;
	} 
	// 设置下拉选择框的选中选项
	$("#textAge").val(currentAge);
 	
});
</script>
</head>
<body>
<div  style=" margin-top:100px ; " >
<form class="form-horizontal" role="form" action="<%=basePath %>AddAndModifyStu" method="post">
   <input type="hidden"  id="txtStuid" name="txtStuid"	value="${student.stuId }"> 
    <input type="hidden"  id="txtSex" name="txtSex"	value="${student.sex }">
    <input type="hidden"  id="txtAge" name="txtAge"	value="${student.age }">
  <div class="form-group" style="padding-left: 200px;">
    <label  class="col-sm-2 control-label">学号</label>
    <div class="col-sm-10" style="width:300px">
      <input type="text" class="form-control" id="textCode" name="textCode" placeholder="学号" value="${student.stuCode }">
    </div>
  </div>
  <div class="form-group" style="padding-left: 200px;">
    <label  class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-10" style="width:300px">
      <input type="text" class="form-control" id="textName" name="textName" value="${student.stuName }" placeholder="姓名">
    </div>
  </div>
  <div class="form-group" style="padding-left: 200px;">
	<label class="col-sm-2 control-label">性别</label>
	  <div class="col-sm-10" style="width: 300px">
		<label class="radio-inline"> 
		<input type="radio" name="textSex" id="textSexM" value="男" <c:if test="${student.sex=='男'}">checked</c:if>>男</label> 
		<label class="radio-inline"> 
		<input type="radio" name="textSex" id="textSexF" value="女" <c:if test="${student.sex=='女'}">checked</c:if>>女</label>

		</div>
	</div>
   <div class="form-group" style="padding-left: 200px">
    <label  class="col-sm-2 control-label">年龄</label>
    <div class="col-sm-10" style="width:300px">
      <select class="form-control" id="textAge" name="textAge">
       <c:forEach begin="18" end="65" varStatus="st">
       <option value="${st.index }">${st.index}</option>
       </c:forEach>
      </select>
          
    </div>
  </div>
  <div class="form-group" style="padding-left: 200px;">
    <label  class="col-sm-2 control-label">联系方式</label>
    <div class="col-sm-10" style="width:300px">
      <input type="text" class="form-control" id="textPhone" name="textPhone" placeholder="联系方式" value="${student.phone }">
    </div>
  </div>
  <div class="form-group" style="padding-left: 200px;">
    <label  class="col-sm-2 control-label">地址</label>
    <div class="col-sm-10" style="width:300px">
      <input type="text" class="form-control" id="textAddress" name="textAddress" value="${student.address }" placeholder="地址">
    </div>
  </div>
  <div  class="form-group" >
    <div class="col-sm-offset-4 col-sm-1" >
      <button type="submit" class="btn btn-default button1" >确认</button>
    </div>
    <div class="col-sm-1">
      <button type="reset" class="btn btn-default  button2" >取消</button>
    </div>
  </div>
</form>
</div>
</body>
</html>